package com.ui.design.view.radar.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.ui.design.R;
import com.ui.design.main.base.BaseActivity;
import com.ui.design.main.constants.Constants;
import com.ui.design.view.radar.view.RadarView;

import androidx.appcompat.app.AppCompatActivity;

/*
*created by ZhuYueZong
* in 2021/7/25
 */
@Route(path = Constants.Radar)
public class RadarActivity extends BaseActivity {
    private Button button;
    private View content;
    private int watcher = 0;

    @Override
    protected int initLayout() {
        return R.layout.activity_radar;
    }

    @Override
    protected void initView() {
        setTitleText("雷达图View","");
        button = findViewById( R.id.scan );
        content = findViewById( R.id.content );
    }

    @Override
    protected void initData() {

        content.setAlpha( 0f );
        button.setAlpha( 1f );
        button.setOnClickListener(v -> {
            if (watcher == 0){
                watcher =1;
                content.setBackgroundResource(R.drawable.view_radar_sky);
                content.animate()
                        .alpha( 1f )
                        .setDuration( 5000 )
                        .setListener( null );
                button.setText( "正在搜寻" );
                button.animate()
                        .alpha( 0.2f )
                        .setDuration( 5000 )
                        .setListener( null );
            }else {
                watcher = 0;
                content.animate()
                        .alpha( 0f )
                        .setDuration( 5000 )
                        .setListener( null );
                button.setText( "正在搜寻" );
                button.animate()
                        .alpha( 1f )
                        .setDuration( 5000 )
                        .setListener( null );
            }
        });
    }
}